package com.example.understandvideo.service.transcode;

import java.util.Collections;
import java.util.List;

/**
 * 转码xml对象转换工具
 */
public class CloudTargetMakerTool {

    public static CloudCutTask getDefaultPToVObject(String taskName, String imagePath, String duration, String voicePath, String picDirPath, String targetDir, String targetFilename) {
        CloudStream cloudStream = new CloudStream(-1,
                new CloudStreamH264(-1, "High", "-1", "720", "576", "source", "-1", "-1", "source", "-1", "-1"
                        , "1", "0", "-1", "218608180", "VBR", "1000", "3000", "0", "1", "1", "375", "1000", "100", "0", "1"
                        , "0", "0", "8", "420", "1", "1", "-1", "5", "20", "0", "1", "0", "0", "2", "1", "CUSTOM", "", "0", "0",
                        new CloudStreamH264SimHd("0", "2", "0", "0", "0", "0", "0", "0", "-1", "0", "0", "0", "0", "0", "3", "3", "-1"
                                , "1.0", "1.0", "1.0", "0"),
                        new CloudStreamH264Preprocessor("", Motionicon.getDefault(picDirPath), "", LutInfo.getDefault())
                )
                , new CloudStreamAAC("LC", "1", "2", "64000", "32000", "0", "0", "-30", "0", "0", "None", "-1", "", "")
        );
        CloudStreams streams = new CloudStreams(Collections.singletonList(cloudStream));
        CloudOutputGroups outputGroups = new CloudOutputGroups(CloudOutputGroupsFileArchive.getDefault(targetDir, targetFilename));
        return new CloudCutTask("1", "/api/task/1", taskName, "", "Custom", "5", "-1", "0", "-1"
                , "0", "-1", "-1", "0", "PENDING", streams, CloudInputs.getImageDefault(imagePath, duration, voicePath), outputGroups);
    }

    public static CloudCutTask getDefaultVCutByTimeObject(String taskName, String filepath, List<TimeSlice> times, String targetDir, String targetFilename) {
        CloudStreams streams = new CloudStreams(CloudStream.getDefault());
        CloudOutputGroups outputGroups = new CloudOutputGroups(CloudOutputGroupsFileArchive.getDefault(targetDir, targetFilename));
        return new CloudCutTask("1", "/api/task/1", taskName, "", "Custom", "5", "-1", "0", "-1"
                , "0", "-1", "-1", "0", "PENDING", streams, CloudInputs.getLocalFileDefault(filepath, times), outputGroups);

    }
}
